#include "SYSTEM/delay/delay.h"
#include "SYSTEM/sys/sys.h"
#include "SYSTEM/usart/usart.h"
#include "BSP/LED/led.h"
#include "BSP/BEEP/beep.h"
#include "BSP/KEY/key.h"

int main() {
	HAL_Init();
	sys_stm32_clock_init(RCC_PLL_MUL9);
	delay_init(72);
	led_init();
	beep_init();
	key_init();
	
	while (1) {
		int key_pres = key_scan(0);
		switch(key_pres) {
			case KEY0_PRES:
				LED0_TOGGLE();
			  LED1_TOGGLE();
				break;
			case KEY1_PRES:
				LED1_TOGGLE();
				break;
			case KEY2_PRES:
				LED0_TOGGLE();
				break;
			case WKUP_PRES:
				BEEP_TOGGLE();
		}
		if (key_pres) {
			delay_ms(1000);
		}
	}
}
